<?php

namespace App\Http\Controllers\Admin;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Services\Admin\LogService;

class LogController extends Controller
{
    /**
     * 显示资源列表。
     */
    public function index(Request $request)
    {
        $params = $request->validate([
            'keywords'  => 'nullable|string',
            'pageNum'   => 'nullable|integer|min:1',
            'pageSize'  => 'nullable|integer|min:5',
        ]);

        $params['pageNum'] = $params['pageNum'] ?? 1;
        $params['pageSize'] = $params['pageSize'] ?? 10;

        $data = LogService::index($params);

        return $this->success(data: $data);
    }
}
